package com.yxqz.manage_course.controller;

import com.xuecheng.api.course.CourseControllerApi;
import com.xuecheng.framework.domain.course.Teachplan;
import com.xuecheng.framework.domain.course.ext.TeachplanNode;
import com.xuecheng.framework.model.response.ResponseResult;
import com.yxqz.manage_course.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 鱼香茄子
 * @data 2021/10/29
 * 课程管理服务实现类
 */

@RestController
@RequestMapping("/course")
public class CourseController implements CourseControllerApi {

    @Autowired
    CourseService courseService;

    /**
     * 通过课程id查看课程计划
     * @param courseId
     * @return
     */
    @GetMapping("/teachplan/list/{courseId}")
    public TeachplanNode findTeachPlanList(String courseId) {
        return courseService.findTeachPlanList(courseId);
    }

    @PostMapping("/teachplan/add")
    public ResponseResult addTeachPlan(@RequestBody Teachplan teachplan) {
        return courseService.addTeachPlan(teachplan);
    }
}
